﻿using Microsoft.Extensions.Configuration;
using MiniFox.Configurations;
using System.Collections.ObjectModel;

namespace TemplateEngine.Configurations
{
    /// <summary>
    /// 
    /// </summary>
    [Section(ELEMENT_NAME)]
    public class TemplateCollection : KeyedCollection<string, TemplateSetting>
    {
        const string ELEMENT_NAME = "minifox:templates";
        /// <summary>
        /// 
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        protected override string GetKeyForItem(TemplateSetting item)
        {
            return item.Name;
        }
    }
    /// <summary>
    /// 
    /// </summary>
    public class TemplateSetting
    {
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("name")]
        public string Name { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("title")]
        public string Title { get; set; }
        /// <summary>
        /// 
        /// </summary>
        [ConfigurationKeyName("path")]
        public string Path { get; set; }
    }
}
